perm filename MAPPED.SAI[HAK,HPM] blob sn#430378 filedate 1979-04-06 generic text, type T, neo UTF8
begin "foo"

define pk(v) = "call ((v) land '777777, ""peek"")", calli = "'047000000000";
integer MASK, I, NUM, J, DDL0, DDNUM, BITS, VDPRM, VDTMP, VDTIE, VDMAP, LETAB, ME;
safe integer array A[0:1], WHO[0:'177];

simple integer procedure SYML (string S);
begin	I ← 1;
	A[0] ← A[1] ← 0;
	for J ← 5 step -1 until 1 do
	begin	A[0] ← A[0] + I * (S[J for 1] - "A" + '13);
		I ← I * '50
	end;
	return (call (location (A[0]), ".syml"))
end;

VDPRM ← syml ("VDPRM");
VDTMP ← syml ("VDTMP");
VDTIE ← syml ("VDTIE");
VDMAP ← syml ("VDMAP");
LETAB ← syml ("LETAB");
I ← pk ('221);
DDL0 ← (I lsh -27) + ((I lsh -18) land '777);
DDNUM ← (I lsh -9) land '777;

do begin print ("Channel? "); MASK ← cvo(inchwl) end until -7 ≤ MASK ≤ 31;
BITS ← (if MASK ≥ 0 then (1 lsh (35-MASK)) else -MASK);
MASK ← (if MASK ≥ 0 then BITS else 7);
arrclr (WHO);
for NUM ← 0 step 1 until DDNUM-1 do
begin
	if I ← pk (VDTIE+NUM) then
		if J ← pk (LETAB+I) then
			J ← pk (VDTMP+J)
		else
			J ← pk (VDPRM+I-DDL0)
	else
		J ← pk (VDMAP+NUM);
	if J land MASK = BITS then
	begin	setformat (0, 7);
		print ("TV-", cvos (DDL0+NUM));
		if I then print (", tied to DD", cvos (I), ",");
		setformat (-12, 7);
		print (" has video map ", cvos (J), '15&'12);
		WHO[NUM] ← true
	end
end;

print ('15&'12 & "End of SAIL execution" & '15&'12);
call (0, "exit");
ME ← ptygtl (0) land '777777;
setformat (0, 7);
print ("Will notify DD", cvos (ME), " of any additions."&'15&'12);
call (cvsix ("copy"), "setnam");
start_code
	label LOOP, LOOP0, UNTIED, NOTEMP, CHECK, REPORT, OKAY;
	movsi 1,'377777;
	calli 1,'400052;
	 jfcl;
	move  1,['1400000];
	addm  1,VDPRM;
	addm  1,VDTIE;
	addm  1,VDMAP;
	addm  1,LETAB;
	movn  1,DDNUM;
	hrlzm 1,DDNUM;
	movei 7,1;
LOOP:	move  2,DDNUM;
	movni 1,1;
	sosn  7;
	 calli 1,'400071;
LOOP0:	movei 1,(2);
	skipn 1,@VDTIE;
	 jrst UNTIED;
	hrrz  3,@LETAB;
	jumpe 3,NOTEMP;
	add   3,VDTMP;
	caige 3,'400000;
	 skipa 3,'400000(3);
	 calli 3,'33;
	move  1,3;
	jrst  CHECK;
NOTEMP:	sub   1,DDL0;
	move  1,@VDPRM;
	jrst  CHECK;
UNTIED:	movei 1,(2);
	move  1,@VDMAP;
CHECK:	and   1,MASK;
	movei 3,0;
	exch  3,WHO[0](2);
	came  1,BITS;
	 jrst OKAY;
	setom WHO[0](2);
	jumpn 3,OKAY;
	movei 3,(2);
	add   3,DDL0;
	setzb 5,6;
REPORT:	movei 4,0;
	lshc  3,-3;
	rot   4,3;
	addi  4,'20;
	lsh   4,(5);
	addi  6,(4);
	addi  5,6;
	jumpn 3,REPORT;
	movei 4,'646615;
	lsh   4,(5);
	add   6,4;
	calli 6,'400071;
	move  3,ME;
	calli 3,'400111;
	movei 3,5;
	calli 3,'31;
	movei 7,10;
OKAY:	aobjn 2,LOOP0;
	movei 3,1;
	calli 3,'31;
	jrst  LOOP
end

end "foo"